<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
<title>{$data.title}--活动资讯</title>

<link rel="stylesheet/less" href="__PUBLIC__/css/style.less" />
<link rel="stylesheet" href="__PUBLIC__/css/font-awesome.css"/>
<link rel="stylesheet" href="__PUBLIC__/css/jquery.fanmenu.css"/>
<script src="__PUBLIC__/js/less-1.5.0.min.js"></script>
<script src="__PUBLIC__/js/jquery-1.11.0.min.js"></script>
<script src="__PUBLIC__/js/jquery.fanmenu.js"></script>
<script type="text/javascript" >
$(document).ready(function() {
	$("#submit").on("click", function (event) {
		event.preventDefault();
		
		if($('select[name="salary"]').val() != 0 && $('input[name="truename"]').val() != null && $('input[name="truename"]').val() != '' && $('input[name="phone"]').val() != ''&& $('input[name="phone"]').val() != null){
				
				var formData = new FormData( $('#joinAct')[0]);
				$.ajax({
			        url: '__URL__/joinAct',
			        type: 'POST',
			        data: formData,
			        async: false,
			        cache: false,
			        contentType: false,
			        processData: false,
			        success: function (result) {
			        	if(result=="ok"){
							alert("报名成功!");
							$('#joinAct')[0].reset();
			       		}else {
			       			alert("报名失败!");
			       		}
			        },
			        error: function(){
			        	alert("报名失败!");
			        },	
			    });
				
	    }else{
	    	alert("请务必填写姓名,手机和收入");
	    }
	});
	
});

</script>

</head>
<body>
<header>
  <a href="__MODULE__/Index/menu" class="btn-back">
    <i class="fa fa-angle-left"></i>
  </a>

  <h2>资讯活动</h2>
</header>
<section class="section-pb">
   <div class="news-show">
    <h1>{$data.title}</h1>
    <cite>发布于：{$data.created_at|date="Y-m-d",###}</cite>
    <div class="content">
      {$data.content}
      	  <if condition=" $data.is_act ">
	  
		   <if condition=" $nowtime lt $data.ended_at  ">
		   <div class="join">
	        <h2>活动报名</h2>
	        <cite>截止时间：{$data.ended_at|date="Y-m-d",###}</cite>
	        <form id='joinAct' onsubmit="return false" >
	          <div class="form-group cc">
	            <label>姓名：</label>
	            <div class="control">
	              <input type="text" name='truename' class="form-control"  placeholder="请填写您的姓名">
	            </div>
	          </div>
	
	          <div class="form-group cc">
	            <label>电话：</label>
	            <div class="control">
	              <input type="text" name='phone' class="form-control"  placeholder="请填写您的电话">
	            </div>
	          </div>
	
			<div class="form-group cc">
	            <label>月收入：</label>
	            <div class="control">
	              <select name="salary" >
	              	<option value="0">请选择</option>
	                <option value="1000-3000">1000-3000</option>
	                <option value="3000-5000">3000-5000</option>
	                <option value="5000-10000">5000-10000</option>
	              </select>
	            </div>
	          </div>	
	
			<div class="form-group cc">
	            <label>QQ：</label>
	            <div class="control">
	              <input type="text" name='qq' class="form-control"  placeholder="请填写您的QQ号">
	            </div>
	          </div>
	
			 <div class="form-group cc">
	            <label>性别：</label>
	            <div class="control">
	              <select name="sex" >
	                <option value="0">男</option>
	                <option value="1">女</option>
	              </select>
	            </div>
	          </div>	
	
	          <div class="form-group cc">
	            <label>职业：</label>
	            <div class="control">
	              <input type="text" name='job' class="form-control"  placeholder="请填写您的职业">
	            </div>
	          </div>
	
	          <div class="form-group cc">
	            <label>人数：</label>
	            <div class="control">
	              <input type="text" name='num' class="form-control"  placeholder="请填写参考人数">
	            </div>
	          </div>
				<input type="hidden" name='act_id' value='{$data.id}'>
	          <div class="form-group cc">
	            <div class="control control-v2">
	              <button type="button" id='submit' class="btn btn-default">确 定</button>
	            </div>
	          </div>
	
	        </form>
	      </div>
	      <else />
			<div class="join">
	        <h2>活动已过期</h2>
	      	</div>	
		  </if>
	  
	  </if>
    </div>
  </div>
</section>
<include file="Public:footer" />

</body>
</html>